package com.linkage.jz.bankruptcy.widget;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.linkage.jz.bankruptcy.BankruptcyApp;
import com.linkage.jz.bankruptcy.Consts;
import com.linkage.jz.bankruptcy.R;
import com.linkage.jz.bankruptcy.activity.MainActivity;
import com.linkage.jz.bankruptcy.activity.RegistLogin.AccountLoginActivity;
import com.linkage.jz.bankruptcy.utils.SPUtils;
import com.linkage.seapeak.activity.register.RegisterActivity;
import com.nostra13.universalimageloader.core.ImageLoader;

import org.greenrobot.eventbus.EventBus;

/**
 * ImageView创建工厂
 */
public class LoginNoticeDialog {

	private static PublicLoginNoticeDialog publicLoginNoticeDialog;

	private static Boolean show = false;

	public static void showPage(String msg)
	{


		if(show)
		{
			return;
		}

		publicLoginNoticeDialog = new PublicLoginNoticeDialog(BankruptcyApp.activityRef, new View.OnClickListener() {
			@Override
			public void onClick( View view ) {

				if (view.getId() == R.id.btn_chancel_notice) {//暂存

				} else if (view.getId() == R.id.ll_close) {

					return;
				} else {//生成
					AccountLoginActivity.start(BankruptcyApp.activityRef);
				}

				publicLoginNoticeDialog.dismiss();
				show = false;
				EventBus.getDefault().post(new MainActivity.ShowHideClearAll(false));
			}
		}, 1, "提示", msg, "取消", "确定");
		//更新UI
//                                Toast.makeText(MainActivity.this,"登录失败",Toast.LENGTH_SHORT).show();
		publicLoginNoticeDialog.show();
		show = true;
		SPUtils.getInstance(Consts.SPNAME).put("userToken", "");
//                BankruptcyApp.loginInfo = null;
		BankruptcyApp.userToken = "";
		BankruptcyApp.loginInfo = null;

	}
}
